#include <functional>
#include <unordered_map>
#include <map>
#include <iostream>
//#include <ostream>
#include <string>

using namespace std;


void foo(const map<int, string>& m)
{
	//m[7] = "seven";
	//cout << m[0] << endl;

	auto i = m.find(3);

	if (i == m.end())
	{
		cout << "Not found" << endl;
	}
	else
	{
		cout << i->second << endl;
	}
}

int main()
{
	#pragma region using of map

	map<int, string> m;
	m[1] = "one";
	m[2] = "two";
	m[4] = "four";
	m[3] = "three";

	// Update
 	m[2] = "TWO!";
// 	cout << m[2] << endl;

	// enum
// 	for (map<int, string>::const_iterator i = m.cbegin(); i != m.cend(); ++i)
// 	{
// 		cout << "(" << i->first << ", " << i->second << ")" << endl;
// 	}
// 
// 	// or enum in c++0x
// 	for (auto i = m.cbegin(); i != m.cend(); ++i)
// 	{
// 		cout << "(" << i->first << ", " << i->second << ")" << endl;
// 	}

	map<int, string, greater<int>> mm;
	mm[1] = "one";
	mm[2] = "two";
	mm[4] = "four";
	mm[3] = "three";

	for (auto i = mm.cbegin(); i != mm.cend(); ++i)
	{
		cout << i->first << " " << i->second << endl;
	}

	m.clear();

	#pragma endregion

	#pragma region using of unordered map

	unordered_map<int, string> um;
	um[1] = "one";
	um[2] = "two";
	um[4] = "four";
	um[3] = "three";

	cout << um[2] << endl;

	um.clear();

	#pragma endregion
}